/**
 * Created by zhaott on 2017/11/14.
 */
/** todo:创建一个写入流 **/
var fs=require('fs');
//创建一个写入流，并把数据写入out.txt
var writeStream=fs.createWriteStream('out.txt');
//以utf-8格式写入数据
writeStream.write('菜鸟教程','utf-8');
//标记文件末尾
writeStream.end();
//处理流事件：finish
writeStream.on('finish',function () {
    console.log('数据写入完成！');
});
//处理流事件：error
writeStream.on('error',function (err) {
   console.log('数据处理失败'+err.stack);
});
console.log("程序执行完毕");